package com.hctforgreen.greenservice.ui.adapter;

import java.util.List;

import u.aly.bo;
import android.app.Activity;
import android.content.Context;
import android.content.IntentFilter;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import cn.dns.reader.network.Util;

import com.hctforgreen.greenservice.DownloadManagerActivityV2;
import com.hctforgreen.greenservice.R;
import com.hctforgreen.greenservice.DownloadManagerActivityV2.DownloadUpdateReceiver;
import com.hctforgreen.greenservice.ctr.DbController;
import com.hctforgreen.greenservice.model.ExamPaperEntity;
import com.hctforgreen.greenservice.model.StudyEntity;
import com.hctforgreen.greenservice.model.BookListEntity.BookEntity;
import com.hctforgreen.greenservice.utils.HctConstants;

/**
 * 考试记录列表适配器
 * 
 * @author dhb 20150602
 * 
 */
public class ExamPaperListAdapter extends BaseAdapter {

	private Activity context;
	private List<ExamPaperEntity> myList;
	private ListView mListView;

	public ExamPaperListAdapter(Activity context, List<ExamPaperEntity> myList,
			ListView listView) {
		this.context = context;
		this.myList = myList;
		this.mListView = listView;
	}

	public int getCount() {
		return myList.size();
	}

	public Object getItem(int position) {
		return myList.get(position);
	}

	public long getItemId(int position) {
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder = null;
		if (convertView == null) {
			holder = new ViewHolder();
			convertView = LayoutInflater.from(context).inflate(
					R.layout.item_exam_paper_lst, null);
			holder.tvName = (TextView) convertView.findViewById(R.id.tv_name);
			holder.tvDate = (TextView) convertView.findViewById(R.id.tv_date);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}

		final ExamPaperEntity entity = myList.get(position);
		holder.tvName.setText(entity.name);
		holder.tvDate.setText(entity.createTime);

		return convertView;
	}

	static class ViewHolder {
		TextView tvName;// 名称
		TextView tvDate;// 时间
		
	}

}